#ifndef ITEMDATA_H
#define ITEMDATA_H

#include <QObject>

class ItemData : public QObject
{
    Q_OBJECT

    Q_PROPERTY(int id READ getid           NOTIFY valuechang)
    Q_PROPERTY(QString itemname READ getitemname   NOTIFY valuechang)
    Q_PROPERTY(QString product READ getproduct  NOTIFY valuechang)
    Q_PROPERTY(QString sample READ getsample     NOTIFY valuechang)
    Q_PROPERTY(int number READ getnumber     NOTIFY valuechang)
    Q_PROPERTY(double tolerance READ gettolerance    NOTIFY valuechang)
    Q_PROPERTY(bool istolerance READ getistolerance   NOTIFY valuechang)
    Q_PROPERTY(QString datetime READ getdatetime   NOTIFY valuechang)
    Q_PROPERTY(double value READ getvalue        NOTIFY valuechang)
    Q_PROPERTY(int precision READ getprecision     NOTIFY valuechang)
    Q_PROPERTY(int index READ getindex         NOTIFY valuechang)


public:
    explicit ItemData(QObject *parent = nullptr);

    //第几次
    int index;
    int getindex(){return index;}
    //id
    int id;
     int getid(){return id;}
    //项目
    QString itemname;
     QString getitemname(){return itemname;}
    //产品
    QString product;
    QString getproduct(){return product;}
    //样品
    QString sample;
       QString getsample(){return sample;}
    //编号
    int number;
     int getnumber(){return number;}
    //容差
    double tolerance;
      double gettolerance(){return tolerance;}


    //是否满足容差
    bool istolerance;
       bool getistolerance(){return istolerance;}
    //时间
    QString datetime;
       QString getdatetime(){return datetime;}
    //值
    double value;
     double getvalue(){return value;}
    //精度
    int precision;
     int getprecision(){return precision;}

     QString jsonString();
     bool setJsonString(QString data);

signals:
   void valuechang();
};

#endif // ITEMDATA_H
